ubuntu 18.04
sudo apt remove npm
sudo apt remove nodejs
cd /usr/local/bin
sudo wget 'https://nodejs.org/dist/v12.5.0/node-v12.5.0-linux-x64.tar.xz'
sudo tar -xJf node-v12.5.0-linux-x64.tar.xz -C /opt
sudo ln -s /opt/node-v12.5.0-linux-x64/bin/node /usr/local/bin/node
sudo ln -s /opt/node-v12.5.0-linux-x64/bin/npm /usr/local/bin/npm
npm -v
node -v
=============================================
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt install nodejs-legacy
出現「Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi」的解決辦法
wget https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb
wget https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i *.deb
=============================================
安裝最新版
https://websiteforstudents.com/install-the-latest-node-js-and-nmp-packages-on-ubuntu-16-04-18-04-lts/
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get install -y nodejs
想對外分享這則貼文嗎?運用網址更方便呦~